import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

/**
 * 充值规则实体
 */
@Entity({ name: 'recharge_rules', comment: '充值奖励配置表' })
export class RechargeRule {
  @ApiProperty({ description: '规则ID' })
  @PrimaryGeneratedColumn({ comment: '规则ID' })
  id: number;

  @ApiProperty({ description: '充值金额（单位：分）' })
  @Column({ 
    type: 'int',
    comment: '充值金额，单位分' 
  })
  rechargeAmount: number;

  @ApiProperty({ description: '赠送代金券金额（单位：分）' })
  @Column({ 
    type: 'int',
    comment: '赠送的代金券金额，单位分' 
  })
  bonusVoucher: number;

  @ApiProperty({ description: '是否启用' })
  @Column({ 
    default: true,
    comment: '规则是否启用' 
  })
  isActive: boolean;

  @ApiProperty({ description: '创建时间' })
  @CreateDateColumn({ comment: '记录创建时间' })
  createdAt: Date;

  @ApiProperty({ description: '更新时间' })
  @UpdateDateColumn({ comment: '记录更新时间' })
  updatedAt: Date;
}